function Msg(){
	this.hasMsg = false;
	this.isNewPage = false;
	this.hided = false;
	this.msgInfo = "";
	this.Pid = "_MsgLabel";
	this.Tid = "_MsgTable";
	this.Mid = "_MsgMarquee";
	this.Main = "main";//要显示的框架名
	this.Top = "m1";//顶端框架名
	this.Loop = 3;
	/**
	设置滚动次数
	*/
	this.setLoop=function(loop){
		try{
			if(isNaN(loop))
				return;
			this.Loop = loop;
			this.document().getElementById(this.Mid).loop = this.Loop;
		}catch(e){}
	}
	/**
	取得文档对象
	*/
	this.document=function(){
		try{
			return window.top.frames[this.Main].document;
		}catch(e){}
	}
	/**
	检查是否可以显示，如果可以就显示
	*/
	this.checkToShow=function(){
		try{
			if(!this.isShowing())
				if(this.hasMsg && !this.hided)
					this.show();
		}catch(e){}
	}
	/**
	是否正在显示
	*/
	this.isShowing=function(){
		try{
			var obj = this.document().getElementById(this.Tid);
			if(obj==null)
				return false;
			if(obj.style.display=='none')
				return false;
		}catch(e){}
	}
	/**
	对外接口，显示消息
	*/
	this.showMsg=function(html){
		try{
			this.hasMsg = true;
			this.hided = false;
			this.msgInfo = html;
			this.showDataArea();
			this.getPanel().innerHTML = "<marquee id='"+this.Mid+"' loop='"+this.Loop+"' onfinish=\"window.top.frames['"+this.Top+"']._Msg.hideDataArea()\" onmouseover='this.stop()' onmouseout='this.start()'>"+html+"</marquee>";
		}catch(e){}
	}
	/**
	内部方法，显示消息对象
	*/
	this.show=function(){
		try{
			this.showDataArea();
			if(this.isNewPage)
				this.showMsg(this.msgInfo);
		}catch(e){}
	}
	/**
	显示对象
	*/
	this.showDataArea=function(){
		try{
			if(!this.document() || !this.document().body)
				return;
			if(this.document().getElementById(this.Pid)==null){
				this.isNewPage = true;
				this.document().body.innerHTML += this.buildDataArea(); 
			}else{
				this.isNewPage = false;
			}
			var obj = this.document().getElementById(this.Tid);
			obj.style.left =0;
			obj.style.top = 0;
			obj.style.display = "block";
			obj.style.backgroundColor = "#CFB158";
		}catch(e){}
	}
	/**
	隐藏显示对象
	*/
	this.hideDataArea=function(){
		try{
			this.document().getElementById(this.Tid).style.display = "none";
			this.hided = true;
		}catch(e){}
	}
	/**
	得到DIV
	*/
	this.getPanel =function(){
		try{
			var obj = this.document().getElementById(this.Pid);
			return obj;
		}catch(e){}
	}
	/**
	创建显示区
	*/
	this.buildDataArea=function(){
		try{
			var tbl = "<table height='20px' style='position:absolute' width='100%' id='"+this.Tid+"'>";
			tbl += "<tr><td  height='20px' width='95%' align='left'>"+this.build()+"</td>";
			tbl += "<td width='5%' align='center' style='cursor:pointer'>";
			tbl += "<img onclick=\"window.top.frames['"+this.Top+"']._Msg.hideDataArea(); window.top.frames['"+this.Top+"']._Msg.hided=true;\" src='../images/delete.gif' title='隐藏'></td></tr></table>";
			return tbl;
		}catch(e){}
	}
	/**
	消息文本
	*/
	this.build=function(){
		try{
			var html = "<div style='font-size:16px' id='"+this.Pid+"' width='100%'></div>";
			return html;
		}catch(e){}
	}
	/**
	进入监听
	*/
	this.start=function(){
		try{
			setInterval("_Msg.checkToShow()",500);
		}catch(e){}
	}
}
var _Msg = new Msg();
_Msg.start();